package com.yztc.ui;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;

import com.yztc.chunboapp.R;

/**
 * Created by Administrator on 2016/10/16.
 */

public class XieyiActivity extends AppCompatActivity {
    private WebView show;
    private String path="http://www.chunbo.com/Topic/topinbyid/id/71";
    private ImageView back_toolbar_xieyi;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_xieyi);
        show= (WebView) findViewById(R.id.show);
        back_toolbar_xieyi= (ImageView) findViewById(R.id.back_toolbar_xieyi);
        show.setWebViewClient(new WebViewClient());
        openUrl(path);
        back();
    }

    private void back() {
        back_toolbar_xieyi.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    private void openUrl(String s) {
        show.loadUrl(s);
        // TODO Auto-generated method stub
        show.getSettings().setJavaScriptEnabled(true);
        show.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
        show.setWebViewClient(new WebViewClient(){
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(url);
                return true;
            }
        });
    }
}
